/*******************************************************************
 *   > File Name: start.S
 *   > Author: fly
 *   > Mail: 1358326274@qq.com
 *   > Create Time: 2020年07月21日 星期二 22时18分24秒
 ******************************************************************/
#define PS_HOLD_CONTROL 0xE010E81C
#define WTCON           0xE2700000
#define SVC_STACK       0xD0037D80

.global _start
_start:
    // Lock 5V power
    ldr r0, = PS_HOLD_CONTROL
    ldr r1, [r0]
    orr r1, r1, #0x300
    orr r1, r1, #0x1
    str r1, [r0]
    
    // disable watch dog
    ldr r0, = WTCON
    mov r1, #0
    str r1, [r0]

    // open icache
    mrc p15, 0, r0, c1, c0, 0
    orr r0, r0, #0x00001000
    mcr p15, 0, r0, c1, c0, 0

    ldr sp, = SVC_STACK
    
    bl main

half:
    b half
